package com.deepocean.controller;

import com.deepocean.common.entity.ResultEntity;
import com.deepocean.entity.LinearScreenCondition;
import com.deepocean.entity.LinearScreenEntity;
import com.deepocean.service.ILinearScreenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 直线筛
 */
@RestController
@RequestMapping("/lineScreen")
public class LinearScreenController {

    @Autowired
    private ILinearScreenService linearScreenService;

    /**
     * 新增接口
     * @param linearScreenEntity
     * @return
     */
    @PostMapping("/v1/add")
    public ResultEntity add(@RequestBody LinearScreenEntity linearScreenEntity) {
        return ResultEntity.success(linearScreenService.add(linearScreenEntity));
    }

    /**
     * 一小时内物料输入输出总和
     * @param deviceId
     * @return
     */
    @PostMapping("/v1/getInAndOutInHour")
    public ResultEntity getInAndOutInHour(@RequestParam String deviceId) {
        return ResultEntity.success(linearScreenService.getInAndOutInHour(deviceId));
    }

    /**
     * 条件查询
     * @param linearScreenCondition
     * @return
     */
    @PostMapping("/v1/getLinearScreenByCondition")
    public ResultEntity getLinearScreenByCondition(@RequestBody LinearScreenCondition linearScreenCondition) {
        return ResultEntity.success(linearScreenService.getLinearScreenByCondition(linearScreenCondition));
    }

    /**
     * 根据设备型号获取理论数据
     * @return
     */
    @PostMapping("/v1/getTheoryData")
    public ResultEntity getTheoryData(String deviceType) {
        return ResultEntity.success("理论数据");
    }
}
